<?php
namespace app\index\controller;
use think\Controller;
use app\index\model\Users;
use app\index\model\Feedback;
use app\common;

class Feedbacks extends Controller
{
	//反馈建议提交 --- $token(验证), $feedback_content(提交内容)
    public function feedBack($token, $feedback_content) {
        //token验证
        $user_id = checkToken($token);
        //检查提交的内容是否为空
        if (empty($feedback_content)) {
            return myJson(-1, '反馈信息提交失败 - 不能为空', '');
        }
        try {
            $feedback = new Feedback;
            $feedback->user_id = $user_id;
            $feedback->feedback_content = $feedback_content;
            $feedback->feedback_commit_time = date('Y-m-d H:i:s');
            $feedback->save();
            return myJson(1, '反馈信息提交成功', '');
        } catch (\Exception $e) {
            return myJson(-1, '反馈信息提交失败 - ' . $e->getMessage(), '');
        }
    }
}

?>